Skip to content

Stop backends from needing to support nullary intrinsics #142839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jun 21, 2025

And then remove our infrastructure special casing them. Further improvements can now be done to them by avoiding the intermediate ConstValue step, but let's leave that to follow up work

r? @RalfJung

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 21, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 21, 2025

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 21, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 21, 2025
@bors
Copy link
Collaborator

bors commented Jun 21, 2025

⌛ Trying commit a44843e with merge a5e9784...

bors added a commit that referenced this pull request Jun 21, 2025
Stop backends from needing to support nullary intrinsics

And then remove our infrastructure special casing them. Further improvements can now be done to them by avoiding the intermediate ConstValue step, but let's leave that to follow up work

r? `@ghost` wanna see perf first
@rust-log-analyzer

This comment has been minimized.


match intrinsic_name {
sym::type_name => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I see this is a code-move & fixup to work in here, but is it worth sorting these arms into the rest of the match? though I guess the other arms are also not sorted simply... it was mostly that needs_drop is between type_id & type_name that caught my eye hehe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, could do that, good point. didn't want to do it in the first commit to kinda make the diff line up

@bors
Copy link
Collaborator

bors commented Jun 21, 2025

☀️ Try build successful - checks-actions
Build commit: a5e9784 (a5e97845d0268f3cbfc1f7da350c0e9127ab0b99)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a5e9784): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
3.2% [2.8%, 3.5%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.3% [-0.3%, -0.3%] 1
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.2%] 2
All ❌✅ (primary) 2.0% [-0.3%, 3.5%] 3

Max RSS (memory usage)

Results (primary 3.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.7% [2.0%, 5.5%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.7% [2.0%, 5.5%] 2

Cycles

Results (primary 2.7%, secondary -6.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.7% [2.7%, 2.8%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-6.5% [-6.5%, -6.5%] 1
All ❌✅ (primary) 2.7% [2.7%, 2.8%] 2

Binary size

Results (primary 0.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.5% [0.0%, 1.1%] 9
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.1%, -0.0%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [-0.1%, 1.1%] 11

Bootstrap: 691.091s -> 687.91s (-0.46%)
Artifact size: 371.86 MiB -> 371.89 MiB (0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jun 22, 2025
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the denullarification branch from 1dd711a to 93129de Compare June 23, 2025 08:46
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-19-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
##[endgroup]
[JIT] mini_core_hello_world (skipped)
##[group][AOT] mini_core_hello_world
[AOT] mini_core_hello_world
##[error]error: internal compiler error: compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1469:17: intrinsic needs_drop must be overridden by codegen_cranelift, but isn't
   --> example/mini_core_hello_world.rs:210:18
    |
210 |         assert!(!intrinsics::needs_drop::<u8>());
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


thread 'rustc' panicked at compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1469:17:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: <rustc_errors::DiagCtxtHandle>::span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::span_bug_fmt::<rustc_span::span_encoding::Span>
   7: rustc_codegen_cranelift::intrinsics::codegen_regular_intrinsic_call
   8: rustc_codegen_cranelift::intrinsics::codegen_intrinsic_call
   9: rustc_codegen_cranelift::abi::codegen_terminator_call
  10: rustc_codegen_cranelift::base::codegen_fn_body
  11: rustc_codegen_cranelift::base::codegen_fn
  12: rustc_codegen_cranelift::driver::aot::module_codegen
  13: rustc_codegen_cranelift::driver::aot::run_aot::{closure#3}::{closure#0}
  14: <&mut rustc_data_structures::sync::parallel::par_map<(usize, &rustc_middle::mir::mono::CodegenUnit), alloc::vec::Vec<(usize, &rustc_middle::mir::mono::CodegenUnit)>, rustc_data_structures::marker::IntoDynSyncSend<rustc_codegen_cranelift::driver::aot::OngoingModuleCodegen>, alloc::vec::Vec<rustc_data_structures::marker::IntoDynSyncSend<rustc_codegen_cranelift::driver::aot::OngoingModuleCodegen>>, rustc_codegen_cranelift::driver::aot::run_aot::{closure#3}::{closure#0}>::{closure#0}::{closure#3} as core::ops::function::FnMut<((usize, &rustc_middle::mir::mono::CodegenUnit),)>>::call_mut
  15: <alloc::vec::into_iter::IntoIter<(usize, &rustc_middle::mir::mono::CodegenUnit)> as core::iter::traits::iterator::Iterator>::try_fold::<(), core::iter::traits::iterator::Iterator::find_map::check<(usize, &rustc_middle::mir::mono::CodegenUnit), rustc_data_structures::marker::IntoDynSyncSend<rustc_codegen_cranelift::driver::aot::OngoingModuleCodegen>, &mut rustc_data_structures::sync::parallel::par_map<(usize, &rustc_middle::mir::mono::CodegenUnit), alloc::vec::Vec<(usize, &rustc_middle::mir::mono::CodegenUnit)>, rustc_data_structures::marker::IntoDynSyncSend<rustc_codegen_cranelift::driver::aot::OngoingModuleCodegen>, alloc::vec::Vec<rustc_data_structures::marker::IntoDynSyncSend<rustc_codegen_cranelift::driver::aot::OngoingModuleCodegen>>, rustc_codegen_cranelift::driver::aot::run_aot::{closure#3}::{closure#0}>::{closure#0}::{closure#3}>::{closure#0}, core::ops::control_flow::ControlFlow<rustc_data_structures::marker::IntoDynSyncSend<rustc_codegen_cranelift::driver::aot::OngoingModuleCodegen>>>
  16: <alloc::vec::Vec<rustc_data_structures::marker::IntoDynSyncSend<rustc_codegen_cranelift::driver::aot::OngoingModuleCodegen>> as alloc::vec::spec_from_iter::SpecFromIter<rustc_data_structures::marker::IntoDynSyncSend<rustc_codegen_cranelift::driver::aot::OngoingModuleCodegen>, core::iter::adapters::filter_map::FilterMap<alloc::vec::into_iter::IntoIter<(usize, &rustc_middle::mir::mono::CodegenUnit)>, rustc_data_structures::sync::parallel::par_map<(usize, &rustc_middle::mir::mono::CodegenUnit), alloc::vec::Vec<(usize, &rustc_middle::mir::mono::CodegenUnit)>, rustc_data_structures::marker::IntoDynSyncSend<rustc_codegen_cranelift::driver::aot::OngoingModuleCodegen>, alloc::vec::Vec<rustc_data_structures::marker::IntoDynSyncSend<rustc_codegen_cranelift::driver::aot::OngoingModuleCodegen>>, rustc_codegen_cranelift::driver::aot::run_aot::{closure#3}::{closure#0}>::{closure#0}::{closure#3}>>>::from_iter
  17: <rustc_session::session::Session>::time::<alloc::vec::Vec<rustc_codegen_cranelift::driver::aot::OngoingModuleCodegen>, rustc_codegen_cranelift::driver::aot::run_aot::{closure#3}>
  18: rustc_codegen_cranelift::driver::aot::run_aot
  19: <rustc_codegen_cranelift::CraneliftCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  20: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
  21: rustc_interface::passes::start_codegen
  22: <rustc_interface::queries::Linker>::codegen_and_build_linker
  23: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  24: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}>
  25: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  26: <alloc::boxed::Box<dyn for<'a> core::ops::function::FnOnce<(&'a rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &'a std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt<'a>>, &'a rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena<'a>>, &'a rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena<'a>>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}), Output = core::option::Option<rustc_interface::queries::Linker>>> as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once
  27: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
  28: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly

warning: the ICE couldn't be written to `/checkout/compiler/rustc_codegen_cranelift/rustc-ice-2025-06-23T09_06_51-20600.txt`: Read-only file system (os error 30)

note: rustc 1.89.0-nightly (633c7cb56 2025-06-23) running on aarch64-unknown-linux-gnu

note: compiler flags: -C panic=abort -Z panic-abort-tests -Z codegen-backend=cranelift -C symbol-mangling-version=v0 -Z randomize-layout -Z unstable-options -Z macro-backtrace -C split-debuginfo=off -C link-arg=-L/usr/lib/llvm-19/lib -C llvm-args=-import-instr-limit=10 -C link-args=-Wl,-z,origin -C link-args=-Wl,-rpath,$ORIGIN/../lib -C debuginfo=2 -C panic=abort -Z force-unstable-if-unmarked

query stack during panic:
end of query stack
terminator _83 = needs_drop::<u8>() -> [return: bb47, unwind unreachable]
fn main() -> () {
    let mut _0: ();
    let _1: ();
    let mut _2: mini_core::Unique<()>;
    let mut _3: mini_core::NonNull<()>;
---
    let mut _49: *const [u8];
    let _50: !;
    let mut _52: &[char];
    let mut _53: bool;
    let mut _54: u8;
    let mut _55: usize;
    let mut _56: *const [char];
    let mut _57: u8;
    let mut _58: (u8, bool);
    let _59: !;
    let _61: &&str;
    let _62: ();
    let mut _63: u8;
    let mut _64: usize;
    let mut _65: *const dyn SomeTrait;
    let _66: !;
    let mut _67: u8;
    let mut _68: usize;
    let mut _69: *const u32;
    let _70: &u32;
    let _71: !;
    let mut _72: u8;
    let mut _73: usize;
    let _74: !;
    let mut _75: bool;
    let mut _76: u8;
    let mut _77: usize;
    let mut _78: *const &dyn SomeTrait;
    let _79: &&dyn SomeTrait;
    let mut _80: u8;
    let mut _81: usize;
    let _82: !;
    let mut _83: bool;
    let _84: !;
    let mut _85: bool;
    let _86: !;
    let mut _87: bool;
    let _88: !;
    let mut _89: bool;
    let _90: !;
    let _91: usize;
    let mut _92: *const main::MyDst<[u8]>;
    let _93: &main::MyDst<[u8]>;
    let _94: &main::MyDst<[u8; 4]>;
    let _95: (u8, u8);
    let mut _96: mini_core::Box<dyn SomeTrait>;
    let mut _97: mini_core::Box<NoisyDrop>;
    let mut _98: NoisyDrop;
    let mut _99: mini_core::Option<fn()>;
    let mut _100: isize;
    let _101: !;
    let mut _102: Ordering;
    let mut _103: isize;
    let _104: !;
    let _105: [NoisyDropInner; 2];
    let mut _106: &[u32];
    let _107: &[u32; 2];
    let mut _108: usize;
    let mut _109: bool;
    let mut _110: usize;
    let mut _111: bool;
    let _112: !;
    let mut _114: bool;
---
    let _123: &u32;
    let _124: usize;
    let mut _125: usize;
    let mut _126: bool;
    let _127: !;
    let mut _128: u8;
    let mut _129: fn(()) -> u8;
    let _130: !;
    let mut _131: usize;
    let mut _132: *const u8;
    let mut _133: *const *const u8;
    let _134: !;
    let mut _135: u8;
    let mut _136: f64;
    let _137: !;
    let mut _139: i8;
    let _140: !;
    let mut _141: u8;
    let _142: !;
    let mut _143: u128;
    let mut _144: u128;
    let mut _145: bool;
    let _146: !;
    let mut _147: u8;
    let mut _148: &&u8;
    let _149: !;
---
    let _169: !;
    let _170: ();
    let _171: ();
    let mut _172: bool;
    let mut _173: u8;
    let mut _174: &&u8;
    let mut _175: u8;
    let mut _176: &&u8;
    let _177: !;
    let mut _179: [f64; 2];
    let _181: usize;
    let mut _182: bool;
    let _183: ();
    let mut _184: &str;
    let mut _185: &u8;
    let mut _186: &u8;
    let mut _187: &u8;
    let mut _188: *const &str;
    scope 1 {
        debug slice => _10;
        let _12: *const i32;
        scope 2 {
            debug slice_ptr => _12;
            let _25: &[u8];
            scope 3 {
                debug hello => _25;
                let _27: *const i8;
                scope 4 {
                    debug ptr => _27;
                    let _30: mini_core::Box<&str>;
                    scope 5 {
                        debug world => _30;
                        let _51: &[char; 5];
                        scope 6 {
                            debug chars => _51;
                            scope 7 {
                                debug chars => _52;
                                let _60: &dyn SomeTrait;
                                scope 8 {
                                    debug a => _60;
                                    scope 9 {
                                    }
                                }
                            }
                        }
                    }
                }
            }
            scope 10 {
                scope 11 {
                    debug x => _106;
                    let _113: &[u32];
                    scope 12 {
                        debug y => _113;
                    }
                    scope 13 {
                        debug f => const 1000f64;
                        let _138: f32;
                        scope 14 {
                            debug f2 => _138;
                            scope 15 {
                                debug amount => const 0_u128;
                                let _151: *const ();
                                scope 16 {
                                    debug nullptr => _151;
                                    let _152: *const main::ExternTypeWrapper;
                                    scope 17 {
                                        debug extern_nullptr => _152;
                                        let _153: *const [u8];
                                        scope 18 {
                                            debug slice_ptr => _153;
                                            let _156: [mini_core::Option<i32>; 2];
                                            scope 19 {
                                                debug repeat => _156;
                                                let _178: main::V;
                                                scope 20 {
                                                    debug f => _178;
                                                    let _180: f64;
                                                    scope 21 {
                                                        debug _a => _180;
                                                    }
                                                }
                                            }
                                        }
                                    }
---
            }
        }
    }

    bb0: {
        _5 = const 1_usize as *mut () (PointerWithExposedProvenance);
        _4 = move _5 as *const () (PtrToPtr);
        _3 = mini_core::NonNull::<()>(move _4);
        _2 = mini_core::Unique::<()> { pointer: move _3, _marker: const mini_core::PhantomData::<()> };
        _1 = take_unique(move _2) -> [return: bb1, unwind unreachable];
    }

    bb1: {
        _6 = take_f32(const 0.100000001f32) -> [return: bb2, unwind unreachable];
    }

    bb2: {
        _7 = call_return_u128_pair() -> [return: bb3, unwind unreachable];
    }

    bb3: {
        _9 = bool_11 { field0: const true, field1: const true, field2: const true, field3: const true, field4: const true, field5: const true, field6: const true, field7: const true, field8: const true, field9: const true, field10: const true };
        _8 = bool_struct_in_11(move _9) -> [return: bb4, unwind unreachable];
    }

    bb4: {
        _11 = const main::promoted[8];
        _10 = copy _11 as &[i32] (PointerCoercion(Unsize, AsCast));
        _13 = &raw const (*_10);
        _12 = move _13 as *const i32 (PtrToPtr);
        _15 = copy _12 as usize (PointerExposeProvenance);
        _16 = Eq(const 4_usize, const 0_usize);
        assert(!move _16, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _15) -> [success: bb5, unwind unreachable];
    }

    bb5: {
        _14 = Rem(move _15, const 4_usize);
        switchInt(move _14) -> [0: bb7, otherwise: bb6];
    }

    bb6: {
        _17 = mini_core::panic(const "slice_ptr as usize % 4 != 0") -> unwind unreachable;
    }

    bb7: {
        _21 = const "Hello %s\n\0";
        _20 = &raw const (*_21);
        _19 = move _20 as *const i8 (PtrToPtr);
        _24 = const "printf\0";
        _23 = &raw const (*_24);
        _22 = move _23 as *const i8 (PtrToPtr);
        _18 = mini_core::libc::printf(move _19, move _22) -> [return: bb8, unwind unreachable];
    }

    bb8: {
        _26 = const b"Hello\x00";
        _25 = copy _26 as &[u8] (PointerCoercion(Unsize, Implicit));
        _28 = &raw const (*_25);
        _27 = move _28 as *const i8 (PtrToPtr);
        _29 = mini_core::libc::puts(copy _27) -> [return: bb9, unwind unreachable];
    }

    bb9: {
        _31 = const "World!\0";
        _30 = mini_core::Box::<&str>::new(move _31) -> [return: bb10, unwind unreachable];
    }

    bb10: {
        _188 = copy ((_30.0: mini_core::Unique<&str>).0: mini_core::NonNull<&str>) as *const &str (Transmute);
        _184 = deref_copy (*_188);
        _34 = &raw const (*_184);
        _33 = move _34 as *const i8 (PtrToPtr);
        _32 = mini_core::libc::puts(move _33) -> [return: bb11, unwind unreachable];
    }

    bb11: {
        _36 = move _30 as mini_core::Box<dyn SomeTrait> (PointerCoercion(Unsize, AsCast));
        _35 = move _36;
        drop(_35) -> [return: bb12, unwind unreachable];
    }

    bb12: {
        _37 = mini_core::intrinsics::bitreverse::<u8>(const 168_u8) -> [return: bb13, unwind unreachable];
    }

    bb13: {
        switchInt(move _37) -> [21: bb15, otherwise: bb14];
    }

    bb14: {
        _38 = mini_core::panic(const "intrinsics::bitreverse(0b10101000u8) != 0b00010101u8") -> unwind unreachable;
    }

    bb15: {
        _39 = mini_core::intrinsics::bswap::<u8>(const 171_u8) -> [return: bb16, unwind unreachable];
    }

    bb16: {
        switchInt(move _39) -> [171: bb18, otherwise: bb17];
    }

    bb17: {
        _40 = mini_core::panic(const "intrinsics::bswap(0xabu8) != 0xabu8") -> unwind unreachable;
    }

    bb18: {
        _41 = mini_core::intrinsics::bswap::<u16>(const 56780_u16) -> [return: bb19, unwind unreachable];
    }

    bb19: {
        switchInt(move _41) -> [52445: bb21, otherwise: bb20];
    }

    bb20: {
        _42 = mini_core::panic(const "intrinsics::bswap(0xddccu16) != 0xccddu16") -> unwind unreachable;
    }

    bb21: {
        _43 = mini_core::intrinsics::bswap::<u32>(const 4293844428_u32) -> [return: bb22, unwind unreachable];
    }

    bb22: {
        switchInt(move _43) -> [3437096703: bb24, otherwise: bb23];
    }

    bb23: {
        _44 = mini_core::panic(const "intrinsics::bswap(0xffee_ddccu32) != 0xccdd_eeffu32") -> unwind unreachable;
    }

    bb24: {
        _45 = mini_core::intrinsics::bswap::<u64>(const 1311768469161565644_u64) -> [return: bb25, unwind unreachable];
    }

    bb25: {
        switchInt(move _45) -> [14762217934593340434: bb27, otherwise: bb26];
    }

    bb26: {
        _46 = mini_core::panic(const "intrinsics::bswap(0x1234_5678_ffee_ddccu64) != 0xccdd_eeff_7856_3412u64") -> unwind unreachable;
    }

    bb27: {
        _49 = &raw const (*_25);
        _48 = mini_core::intrinsics::size_of_val::<[u8]>(move _49) -> [return: bb28, unwind unreachable];
    }

    bb28: {
        _47 = move _48 as u8 (IntToInt);
        switchInt(move _47) -> [6: bb30, otherwise: bb29];
    }

    bb29: {
        _50 = mini_core::panic(const "intrinsics::size_of_val(hello) as u8 != 6") -> unwind unreachable;
    }

    bb30: {
        _51 = const main::promoted[7];
        _52 = copy _51 as &[char] (PointerCoercion(Unsize, AsCast));
        _56 = &raw const (*_52);
        _55 = mini_core::intrinsics::size_of_val::<[char]>(move _56) -> [return: bb31, unwind unreachable];
    }

    bb31: {
        _54 = move _55 as u8 (IntToInt);
        _58 = MulWithOverflow(const 4_u8, const 5_u8);
        assert(!move (_58.1: bool), "attempt to compute `{} * {}`, which would overflow", const 4_u8, const 5_u8) -> [success: bb32, unwind unreachable];
    }

    bb32: {
        _57 = move (_58.0: u8);
        _53 = Ne(move _54, move _57);
        switchInt(move _53) -> [0: bb34, otherwise: bb33];
    }

    bb33: {
        _59 = mini_core::panic(const "intrinsics::size_of_val(chars) as u8 != 4 * 5") -> unwind unreachable;
    }

    bb34: {
        _61 = const main::promoted[6];
        _60 = copy _61 as &dyn SomeTrait (PointerCoercion(Unsize, Implicit));
        _62 = <dyn SomeTrait as SomeTrait>::object_safe(copy _60) -> [return: bb35, unwind unreachable];
    }

    bb35: {
        _65 = &raw const (*_60);
        _64 = mini_core::intrinsics::size_of_val::<dyn SomeTrait>(move _65) -> [return: bb36, unwind unreachable];
    }

    bb36: {
        _63 = move _64 as u8 (IntToInt);
        switchInt(move _63) -> [16: bb38, otherwise: bb37];
    }

    bb37: {
        _66 = mini_core::panic(const "intrinsics::size_of_val(a) as u8 != 16") -> unwind unreachable;
    }

    bb38: {
        _70 = const main::promoted[5];
        _69 = &raw const (*_70);
        _68 = mini_core::intrinsics::size_of_val::<u32>(move _69) -> [return: bb39, unwind unreachable];
    }

    bb39: {
        _67 = move _68 as u8 (IntToInt);
        switchInt(move _67) -> [4: bb41, otherwise: bb40];
    }

    bb40: {
        _71 = mini_core::panic(const "intrinsics::size_of_val(&0u32) as u8 != 4") -> unwind unreachable;
    }

    bb41: {
        _73 = AlignOf(u16);
        _72 = move _73 as u8 (IntToInt);
        switchInt(move _72) -> [2: bb43, otherwise: bb42];
    }

    bb42: {
        _74 = mini_core::panic(const "intrinsics::align_of::<u16>() as u8 != 2") -> unwind unreachable;
    }

    bb43: {
        _79 = &_60;
        _78 = &raw const (*_79);
        _77 = mini_core::intrinsics::align_of_val::<&dyn SomeTrait>(move _78) -> [return: bb44, unwind unreachable];
    }

    bb44: {
        _76 = move _77 as u8 (IntToInt);
        _81 = AlignOf(&str);
        _80 = move _81 as u8 (IntToInt);
        _75 = Ne(move _76, move _80);
        switchInt(move _75) -> [0: bb46, otherwise: bb45];
    }

    bb45: {
        _82 = mini_core::panic(const "intrinsics::align_of_val(&a) as u8 != intrinsics::align_of::<&str>() as u8") -> unwind unreachable;
    }

    bb46: {
        _83 = mini_core::intrinsics::needs_drop::<u8>() -> [return: bb47, unwind unreachable];
    }

    bb47: {
        switchInt(move _83) -> [0: bb49, otherwise: bb48];
    }

    bb48: {
        _84 = mini_core::panic(const "! !intrinsics::needs_drop::<u8>()") -> unwind unreachable;
    }

    bb49: {
        _85 = mini_core::intrinsics::needs_drop::<[u8]>() -> [return: bb50, unwind unreachable];
    }

    bb50: {
        switchInt(move _85) -> [0: bb52, otherwise: bb51];
    }

    bb51: {
        _86 = mini_core::panic(const "! !intrinsics::needs_drop::<[u8]>()") -> unwind unreachable;
    }

    bb52: {
        _87 = mini_core::intrinsics::needs_drop::<NoisyDrop>() -> [return: bb53, unwind unreachable];
    }

    bb53: {
        switchInt(move _87) -> [0: bb54, otherwise: bb55];
    }

    bb54: {
        _88 = mini_core::panic(const "! intrinsics::needs_drop::<NoisyDrop>()") -> unwind unreachable;
    }

    bb55: {
        _89 = mini_core::intrinsics::needs_drop::<NoisyDropUnsized>() -> [return: bb56, unwind unreachable];
    }

    bb56: {
        switchInt(move _89) -> [0: bb57, otherwise: bb58];
    }

    bb57: {
        _90 = mini_core::panic(const "! intrinsics::needs_drop::<NoisyDropUnsized>()") -> unwind unreachable;
    }

    bb58: {
        _94 = const main::promoted[4];
        _93 = copy _94 as &main::MyDst<[u8]> (PointerCoercion(Unsize, AsCast));
        _92 = &raw const (*_93);
        _91 = mini_core::intrinsics::size_of_val::<main::MyDst<[u8]>>(move _92) -> [return: bb59, unwind unreachable];
    }

    bb59: {
        _95 = zeroed::<(u8, u8)>() -> [return: bb60, unwind unreachable];
    }

    bb60: {
        _98 = NoisyDrop { text: const "Boxed outer got dropped!\0", inner: const NoisyDropInner };
        _97 = mini_core::Box::<NoisyDrop>::new(move _98) -> [return: bb61, unwind unreachable];
    }

    bb61: {
        _96 = move _97 as mini_core::Box<dyn SomeTrait> (PointerCoercion(Unsize, AsCast));
        drop(_96) -> [return: bb62, unwind unreachable];
    }

    bb62: {
        _99 = const main::FUNC_REF;
        _100 = discriminant(_99);
        switchInt(move _100) -> [0: bb65, 1: bb64, otherwise: bb63];
    }

    bb63: {
        unreachable;
    }

    bb64: {
        _101 = mini_core::panic(const "! false") -> unwind unreachable;
    }

    bb65: {
        _102 = Ordering::Less;
        _103 = discriminant(_102);
        switchInt(move _103) -> [18446744073709551615: bb67, otherwise: bb66];
    }

    bb66: {
        _104 = mini_core::panic(const "! false") -> unwind unreachable;
    }

    bb67: {
        drop(_105) -> [return: bb68, unwind unreachable];
    }

    bb68: {
        _107 = const main::promoted[3];
        _106 = copy _107 as &[u32] (PointerCoercion(Unsize, AsCast));
        _110 = Len((*_106));
        switchInt(move _110) -> [0: bb71, otherwise: bb69];
    }

    bb69: {
        _108 = Len((*_106));
        _109 = Ge(move _108, const 1_usize);
        switchInt(move _109) -> [0: bb63, otherwise: bb70];
    }

    bb70: {
        _113 = &(*_106)[1:];
        _118 = const 1_usize;
        _119 = PtrMetadata(copy _106);
        _120 = Lt(copy _118, copy _119);
        assert(move _120, "index out of bounds: the length is {} but the index is {}", move _119, copy _118) -> [success: bb73, unwind unreachable];
    }

    bb71: {
        _111 = Ne(const 0_u32, const 1_u32);
        switchInt(move _111) -> [0: bb76, otherwise: bb72];
    }

    bb72: {
        _112 = mini_core::panic(const "0u32 != 1") -> unwind unreachable;
    }

    bb73: {
        _117 = &(*_106)[_118];
        _116 = &raw const (*_117);
        _115 = move _116 as usize (PointerExposeProvenance);
        _124 = const 0_usize;
        _125 = PtrMetadata(copy _113);
        _126 = Lt(copy _124, copy _125);
        assert(move _126, "index out of bounds: the length is {} but the index is {}", move _125, copy _124) -> [success: bb74, unwind unreachable];
    }

    bb74: {
        _123 = &(*_113)[_124];
        _122 = &raw const (*_123);
        _121 = move _122 as usize (PointerExposeProvenance);
        _114 = Ne(move _115, move _121);
        switchInt(move _114) -> [0: bb76, otherwise: bb75];
    }

    bb75: {
        _127 = mini_core::panic(const "&x[1] as *const u32 as usize != &y[0] as *const u32 as usize") -> unwind unreachable;
    }

    bb76: {
        _129 = const ZeroSized: {closure@example/mini_core_hello_world.rs:263:18: 263:22} as fn(()) -> u8 (PointerCoercion(ClosureFnPointer(Safe), AsCast));
        _128 = move _129(const ()) -> [return: bb77, unwind unreachable];
    }

    bb77: {
        switchInt(move _128) -> [42: bb79, otherwise: bb78];
    }

    bb78: {
        _130 = mini_core::panic(const "((|()| 42u8) as fn(()) -> u8)(()) != 42") -> unwind unreachable;
    }

    bb79: {
        _133 = const {alloc19: *const *const u8};
        _132 = copy (*_133);
        _131 = move _132 as usize (PointerExposeProvenance);
        switchInt(move _131) -> [0: bb81, otherwise: bb80];
    }

    bb80: {
        _134 = mini_core::panic(const "ABC as usize != 0") -> unwind unreachable;
    }

    bb81: {
        _136 = const 1000f64;
        _135 = move _136 as u8 (FloatToInt);
        switchInt(move _135) -> [255: bb83, otherwise: bb82];
    }

    bb82: {
        _137 = mini_core::panic(const "f as u8 != 255") -> unwind unreachable;
    }

    bb83: {
        _138 = const -1000f32;
        _139 = copy _138 as i8 (FloatToInt);
        switchInt(move _139) -> [128: bb85, otherwise: bb84];
    }

    bb84: {
        _140 = mini_core::panic(const "f2 as i8 != -128") -> unwind unreachable;
    }

    bb85: {
        _141 = copy _138 as u8 (FloatToInt);
        switchInt(move _141) -> [0: bb87, otherwise: bb86];
    }

    bb86: {
        _142 = mini_core::panic(const "f2 as u8 != 0") -> unwind unreachable;
    }

    bb87: {
        _144 = const 0_u128;
        _145 = Lt(copy _144, const 128_u128);
        assert(move _145, "attempt to shift left by `{}`, which would overflow", copy _144) -> [success: bb88, unwind unreachable];
    }

    bb88: {
        _143 = Shl(const 1_u128, move _144);
        switchInt(move _143) -> [1: bb90, otherwise: bb89];
    }

    bb89: {
        _146 = mini_core::panic(const "1u128 << amount != 1") -> unwind unreachable;
    }

    bb90: {
        _148 = const {alloc10: &&u8};
        _185 = deref_copy (*_148);
        _147 = copy (*_185);
        switchInt(move _147) -> [42: bb92, otherwise: bb91];
    }

    bb91: {
        _149 = mini_core::panic(const "*ANOTHER_STATIC != 42") -> unwind unreachable;
    }

    bb92: {
        _150 = check_niche_behavior() -> [return: bb93, unwind unreachable];
    }

    bb93: {
        _151 = const 0_usize as *const () (PointerWithExposedProvenance);
        _152 = copy _151 as *const main::ExternTypeWrapper (PtrToPtr);
        _155 = const main::promoted[2];
        _154 = &raw const (*_155);
        _153 = move _154 as *const [u8] (PointerCoercion(Unsize, AsCast));
        _157 = mini_core::Option::<i32>::Some(const 42_i32);
        _156 = [move _157; 2];
        _160 = const 0_usize;
        _161 = Lt(copy _160, const 2_usize);
        assert(move _161, "index out of bounds: the length is {} but the index is {}", const 2_usize, copy _160) -> [success: bb94, unwind unreachable];
    }

    bb94: {
        _159 = &_156[_160];
        _162 = const main::promoted[1];
        _158 = <mini_core::Option<i32> as mini_core::PartialEq>::ne(move _159, move _162) -> [return: bb95, unwind unreachable];
    }

    bb95: {
        switchInt(move _158) -> [0: bb97, otherwise: bb96];
    }

    bb96: {
        _163 = mini_core::panic(const "repeat[0] != Some(42)") -> unwind unreachable;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants